package com.itheima.stock.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itheima.stock.mapper.SysRoleMapper;
import com.itheima.stock.pojo.SysRole;
import com.itheima.stock.service.RoleService;
import com.itheima.stock.vo.resp.PageResult;
import com.itheima.stock.vo.resp.R;
import com.itheima.stock.vo.resp.RoleJiaZai;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleServiceImpl implements RoleService {

    @Autowired
    private SysRoleMapper sysRoleMapper;

    //查询role的数据
    @Override
    public R<PageResult<SysRole>> findRole(RoleJiaZai roleJiaZai) {
        PageHelper.startPage(roleJiaZai.getPageNum(), roleJiaZai.getPageSize());
        List<SysRole> roles = sysRoleMapper.findRole();
        PageInfo<SysRole> sysRolePageInfo = new PageInfo<>(roles);
        PageResult<SysRole> sysRolePageResult = new PageResult<>(sysRolePageInfo);
        return R.ok(sysRolePageResult);
    }


}
